package com.da.javatest.leetCode2;

public class Code359 {
    public int countNumbersWithUniqueDigits(int n) {
        int count = 0;
        for (int i = 0; i < (int) Math.pow(10, n); i++) {
            if (isRepeat(i)) {
                count++;
            }
        }
        return count;
    }

    private boolean isRepeat(int n) {
        if (n < 11) {
            return true;
        }
        String s = n + "";
        for (char c : s.toCharArray()) {
            if (s.indexOf(c) != s.lastIndexOf(c)) {
                return false;
            }
        }
        return true;
    }
}
